(function($){
	//搜索类型下拉
	$(document).delegate('.search-box-item','click',function(e) {
		e.stopPropagation();
		$(this).children('ul').slideToggle();
		$('.search-text-con').hide();
	});
	//点击空白区，搜索类型下拉隐藏
	$(document).click(function() {
			if ($('.search-box-item ul').is(":visible")) {
				$('.search-box-item ul').hide();
			}
		})
	//菜单下拉
	$(document).delegate('#nav-list>li>div','click',function(e){
		e.stopPropagation();
		$(this).toggleClass('active');
		$(this).next('ul').slideToggle();
	})
	// 获取项目名
	function getProjectName(){
		 // 获取项目根目录之后的目录
	    var pathName = window.document.location.pathname;
	    // 获取带"/"的项目名
	    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
	    return projectName;
	}
	//加载公共头部
    function loadTopMenu(){
    	$.get(getProjectName()+"/en/tpl/common_top_tpl.html", function (template) {
    		  var ractive = new Ractive({
  	            el: ".common-head",
  	            template: template,
  	            data:{
  	            	"projectName":getProjectName()
  	            },
  	            oncomplete: function () {
  	            	
  	            }
    		  })
    	})
    }
	//加载左侧菜单项
    function loadLeftMenu(){
    	$.get(getProjectName()+"/en/tpl/common_left_menu.html", function (template) {
    		  var ractive = new Ractive({
  	            el: ".index-menu",
  	            template: template,
  	            data:{
  	            	"projectName":getProjectName()
  	            },
  	            oncomplete: function () {
  	            	
  	            }
    		  })
    	})
    }
  //加载公共底部
    function loadFootMenu(){
    	$.get(getProjectName()+"/en/tpl/common_foot_tpl.html", function (template) {
    		  var ractive = new Ractive({
  	            el: ".common-foot",
  	            template: template,
  	            data:{
  	            	"projectName":getProjectName()
  	            },
  	            oncomplete: function () {
  	            	
  	            }
    		  })
    	})
    }
    loadLeftMenu();
    loadTopMenu();
    loadFootMenu();
})(jQuery)